package fschmidt.util.java;

import java.util.concurrent.ExecutionException;


public final class ComputationException extends RuntimeException {

	public ComputationException(Exception e) {
		super(e);
	}

	public static ComputationException newInstance(ExecutionException e) {
		Throwable cause = e.getCause();
		if( cause instanceof Error )
			throw (Error)cause;
		if( cause instanceof RuntimeException )
			throw (RuntimeException)cause;
		if( cause instanceof Exception )
			return new ComputationException((Exception)cause);
		return new ComputationException(e);
	}
}
